#include <stdio.h>
float grade[10][5];
void averagec(void);
void highestc(void);
void variancec(void);
float average_student[10],average_course[5];
float highest=0,variance=0,average=0,sum=0;
int hi=0,hj=0;
int main(){
    int i=0,j=0;
    for(i=0;i<9;i++){
        printf("input score of student %d:",i+1);
        for(j=0;j<5;j++){
            scanf("%f",&grade[i][j]);
        }
    }
    printf("input score of student10:",i+1);
        for(j=0;j<5;j++){
            scanf("%f",&grade[9][j]);
        }
    printf("\n");
    averagec();
    highestc();
    variancec();
    printf("NO.     cour1   cour2   cour3   cour4   cour5   aver\n\n");
    for(i=0;i<9;i++){
        printf("NO %d",i+1);
        for(j=0;j<5;j++){
            printf("   %.2f",grade[i][j]);
        }
        printf("   %.2f",average_student[i]);
        printf("\n\n");
    }
    printf("NO10");
    for(j=0;j<5;j++){
        printf("   %.2f",grade[9][j]);
    }
    printf("   %.2f",average_student[9]);
    printf("\n\n");
    printf("average:");
    for(j=0;j<5;j++){
        printf("   %.2f",average_course[j]);
    }
    printf("\n");
    printf("highest:   %.2f NO. %d course%2d",highest,hi,hj);
    printf("\n");
    printf("variance   %.2f",variance);

}
void averagec(void){
    for(int i=0;i<10;i++){
        for(int j=0;j<5;j++){
            sum+=grade[i][j];
        }
        average_student[i]=sum/5;
        sum=0;
    }
    for(int i=0;i<5;i++){
        for(int j=0;j<10;j++){
            sum+=grade[j][i];
        }
        average_course[i]=sum/10;
        sum=0;
    }
}

void highestc(void){
    for(int i=0;i<10;i++){
        for(int j=0;j<5;j++){
            if(highest<grade[i][j]){
                highest=grade[i][j];
                hi=i+1;
                hj=j+1;
            }
        }
    }

}

void variancec(void){
    for(int i=0;i<10;i++){
        sum+=(average_student[i]*average_student[i]);
    }
    variance=sum/10;
    sum=0;
    for(int i=0;i<10;i++){
        sum+=average_student[i];
    }
    sum=sum/10;
    variance-=sum*sum;
    sum=0;
}